﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers {
    import net.wooga.pets.loading.vos.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.models.world.vos.actors.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.models.world.*;

    public class UpdateBabyAndShowPopupCommand extends Command {

        public var event:InfoEvent;
        public var world:WorldModel;

        override public function execute():void{
            var _local1:RequestEvent = new RequestEvent(EventConstants.SEND_REQUEST, this.onResult);
            _local1.addRequest("pet_status", {id:this.event.info.id});
            dispatch(_local1);
        }
        private function onResult(_arg1:ResultVO):void{
            var _local2:Object;
            var _local3:BabyVO;
            var _local4:BabyVO;
            if (_arg1.success){
                _local2 = _arg1.data.pet_status;
                _local3 = (this.world.getActor(this.event.info.id) as BabyVO);
                length;
                _local4 = new BabyVO(_local2, eventDispatcher);
                _local3.momId = _local4.momId;
                _local3.dadId = _local4.dadId;
            };
            dispatch(new InfoEvent(EventConstants.CREATE_POPUP, this.event.id, this.event.info));
        }

    }
}//package net.wooga.pets.controllers 
